package gui;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.UIManager;
import net.miginfocom.swing.MigLayout;

import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JSplitPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.plaf.SplitPaneUI;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;





public class MainFrame extends JFrame{
	/**.
     * Glowny listner
     */
	
	public MainFrame(String name, int widthFrame, int heightFrame) {
//		try {
//			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
		setTitle(name);
		setSize(widthFrame, heightFrame);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		menuBar.add(Box.createHorizontalGlue());
		JMenu mnNewMenu = new JMenu("Pomoc");
		menuBar.add(mnNewMenu);
		
		JMenuItem mntmNewMenuItem = new JMenuItem("O programie");
		mntmNewMenuItem.addActionListener(new ActionListener(){

            @Override
            public void actionPerformed(ActionEvent arg0) {
            	new Oprogramie();
            }
            	
            
        });
		//mnNewMenu.add(mntmNewMenuItem);
		
		JMenuItem mntmNewMenuItem_1 = new JMenuItem("Autorzy");
		mntmNewMenuItem_1.addActionListener(new ActionListener(){

            @Override
            public void actionPerformed(ActionEvent arg0) {
            	new Autorzy();
            }
            	
            
        });
		mnNewMenu.add(mntmNewMenuItem_1);
		
		
		
		

		this.run();
	}
	


	public void run() {
		
		getContentPane().add(Template.getInstance());
		Template.getInstance().setEnabled(false);
		pack();
		setResizable(false);
		setVisible(true);
		setSize(new Dimension(890,530));
		setIconImage(new ImageIcon("car.png").getImage());
		Toolkit toolkit = Toolkit.getDefaultToolkit();
        Dimension ekran = toolkit.getScreenSize();
        setLocation((ekran.width-890)/2, (ekran.height-530)/2); 
	}
	
}
